﻿<UserControl x:Class="Notoric.Gui.Controls.PrintBackstageTab"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:cvr="clr-namespace:Notoric.Gui.Converters"
             xmlns:rb="clr-namespace:Fluent;assembly=Fluent"
             xmlns:vm="clr-namespace:Notoric.ViewModel;assembly=ViewModel"
             xmlns:vme="clr-namespace:Notoric.ViewModel.Elements;assembly=ViewModel"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="800"
             DataContext="{Binding RelativeSource={RelativeSource Self}}"
             Loaded="UserControl_Loaded">
    <Grid>
        <Grid.Resources>
            <cvr:ScoreToFixedDocumentConverter x:Key="scoreConverter"/>
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="420"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>

        <StackPanel Orientation="Vertical" Grid.Column="0" Margin="10">
            <Label Content="Print" FontSize="22" FontWeight="SemiBold" />
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="220"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <TreeView x:Name="PrintTab_ScoresTree" Height="100" MaxHeight="100" Grid.Column="0" SelectedItemChanged="PrintTab_ScoresTree_SelectedItemChanged">
                    <TreeView.Resources>
                        <DataTemplate DataType="{x:Type vme:Score}">
                            <StackPanel Orientation="Horizontal">
                                <Image Source="{Binding Path=Icon, Mode=OneWay}" Height="16" Width="16" Margin="0 0 4 0"/>
                                <TextBlock Text="{Binding Path=DisplayName, Mode=OneWay}"/>
                            </StackPanel>
                        </DataTemplate>

                        <HierarchicalDataTemplate DataType="{x:Type vm:Directory}"  ItemsSource="{Binding Path=Children, Mode=OneWay}">
                            <StackPanel Orientation="Horizontal">
                                <Image Source="{Binding Path=Icon, Mode=OneWay}" Height="16" Width="16" Margin="0 0 4 0"/>
                                <TextBlock Text="{Binding Path=DisplayName, Mode=OneWay}"/>
                            </StackPanel>
                        </HierarchicalDataTemplate>
                    </TreeView.Resources>
                </TreeView>
                <StackPanel Orientation="Vertical" Grid.Column="1" Margin="10 10 10 10">
                    <Button x:Name="PrintTab_Print_Button" Width="64" Height="64" Background="White" IsEnabled="False" IsDefault="True" Click="PrintTab_Print_Button_Click">
                        <Button.Content>
                            <StackPanel Orientation="Vertical">
                                <Image Source="../Resources/Images/Ribbon/Large/Printer.png" Height="32" Width="32" HorizontalAlignment="Center"/>
                                <Label Content="Print" HorizontalAlignment="Center"/>
                            </StackPanel>
                        </Button.Content>
                    </Button>
                    <rb:Spinner x:Name="PrintTab_CopiesSpinner" Minimum="1" Value="{Binding PrintDlg.PrintTicket.CopyCount, Mode=OneWayToSource}" Text="Copies:" Width="124" Format="0" Margin="-10 5 0 0"
                                HorizontalAlignment="Left" Increment="1"/>
                </StackPanel>
            </Grid>
            <Label Content="Printer" FontSize="22" FontWeight="SemiBold" />
            <ComboBox x:Name="PrintTab_Printers_ComboBox" Background="White" Height="32"
                      SelectionChanged="PrintTab_Printers_ComboBox_SelectionChanged">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../Resources/Images/Ribbon/Small/Printer.png" Height="24" Width="24"/>
                            <TextBlock Text="{Binding FullName, Mode=OneWay}" FontWeight="Bold" VerticalAlignment="Center" Margin="4 0 0 0" />
                        </StackPanel>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
            <StackPanel Orientation="Vertical" HorizontalAlignment="Right">
                <Label x:Name="ShowPrinterSettings" Content="Printer Settings" Foreground="Brown" Padding="2 2 2 0" Margin="0 4 2 0" BorderBrush="Brown" BorderThickness="0 0 0 1"
                       Cursor="Hand" IsEnabled="False" MouseLeftButtonDown="ShowPrinterSettings_MouseLeftButtonDown"/>
            </StackPanel>
            <Label Content="Settings" FontSize="22" FontWeight="SemiBold" />
            <ComboBox x:Name="PrintTab_PageRangeSelection_ComboBox" Background="White" Height="42" SelectedIndex="0"
                      SelectionChanged="PrintTab_PageRangeSelection_ComboBox_SelectionChanged">
                <StackPanel Orientation="Horizontal" Height="40" VerticalAlignment="Center">
                    <Image Source="../Resources/Images/Ribbon/Large/AllPages.png" Width="32" Height="32"/>
                    <StackPanel Orientation="Vertical">
                        <TextBlock Text="Print All Pages"/>
                        <TextBlock Text="Print the entire score" Foreground="Gray"/>
                    </StackPanel>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Height="40" VerticalAlignment="Center">
                    <Image Source="../Resources/Images/Ribbon/Large/AllPages.png" Width="32" Height="32"/>
                    <StackPanel Orientation="Vertical">
                        <TextBlock Text="Print Selection"/>
                        <TextBlock Text="Print only selected pages" Foreground="Gray"/>
                    </StackPanel>
                </StackPanel>
            </ComboBox>
            <StackPanel Orientation="Horizontal" Margin="0 4 0 0">
                <Label Content="Pages:"/>
                <TextBox x:Name="PrintTab_SelectedPages" Width="329" KeyUp="PrintTab_SelectedPages_KeyUp" />
            </StackPanel>
        </StackPanel>

        <DocumentViewer x:Name="PrintTab_PrintPreview" Grid.Column="1" Document="{Binding ElementName=PrintTab_ScoresTree,Path=SelectedItem,Converter={StaticResource scoreConverter}}">

        </DocumentViewer>
    </Grid>
</UserControl>
